﻿<?xml version="1.0" encoding="UTF-8" ?>
<sqlMap namespace="Dummy"
	xmlns="http://ibatis.apache.org/mapping"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

	<resultMaps>
		<resultMap id="dummy" class="Yawf.Test.DummyClass, Yawf.Test">
			<result property="Id" column="id"/>
			<result property="Value1" column="value1"/>
			<result property="Value2" column="value2"/>
			<result property="Value3" column="value3"/>
			<result property="Value4" column="value4"/>
		</resultMap>
	</resultMaps>

	<statements>
		<select id="getDummyById" parameterClass="System.Int32" resultMap="dummy">
			SELECT id
			,value1
			,value2
			,value3
			,value4
			FROM dummy
			WHERE id = #value#
		</select>

		<select id="getDummies" resultMap="dummy">
			SELECT id
			,value1
			,value2
			,value3
			,value4
			FROM dummy
		</select>
		
		<insert id="insertDummy" parameterClass="Yawf.Test.DummyClass, Yawf.Test" resultClass="int">
			INSERT INTO dummy
			(value1
			,value2
			,value3
			,value4)
			VALUES
			(#Value1#
			,#Value2#
			,#Value3#
			,#Value4#)
			<selectKey resultClass="int" type="post" property="Id">
				SELECT @@IDENTITY AS value
			</selectKey>
		</insert>

		<update id="updateDummy" parameterClass="Yawf.Test.DummyClass, Yawf.Test">
			UPDATE dummy SET
			value1 = #Value1#
			,value2 = #Value2#
			,value3 = #Value3#
			,value4 = #Value4#
			WHERE id = #Id#
		</update>

		<delete id="deleteDummy" parameterClass="System.Int32">
			DELETE FROM dummy
			WHERE id = #value#
		</delete>
	</statements>

</sqlMap>